package com.luyuan.controller;

import com.luyuan.common.util.ResponseUtils;
import com.luyuan.dao.dto.User;
import com.luyuan.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: lailuyuan
 * @date: 2025-01-22 10:11
 * @desc:
 */
@Api(tags = "用户管理接口")
@RestController
@RequestMapping("/users")
public class UserController {

   @Autowired
   private UserService userService;

   @GetMapping("/list")
   public ResponseUtils getAllUsers() {
      return ResponseUtils.success(userService.getAllUsers());
   }

   @PostMapping("/add")
   public ResponseUtils createUser(@RequestBody User user) {
      userService.saveUser(user);
      return ResponseUtils.success();
   }

}

